package cn.ichiva.service;

import org.springframework.data.redis.core.HashOperations;

import java.util.*;

public class HashService {
    private final HashOperations<String, String,String> hash;

    public HashService(HashOperations<String, String, String> hash) {
        this.hash = hash;
    }
    
    public Long delete(String key, ArrayList<String> hashKeys) {
        return hash.delete(key,  hashKeys.toArray());
    }

    public Boolean hasKey(String key, String hashKey) {
        return hash.hasKey(key, hashKey);
    }

    public String get(String key, String hashKey) {
        return hash.get(key, hashKey);
    }

    public List<String> multiGet(String key, Collection<String> hashKeys) {
        return hash.multiGet(key, hashKeys);
    }

    public Long incrementLong(String key, String hashKey, long delta) {
        return hash.increment(key, hashKey, delta);
    }
   
    public Double incrementDouble(String key, String hashKey, double delta) {
        return hash.increment(key, hashKey, delta);
    }

    public Set<String> keys(String key) {
        return hash.keys(key);
    }

    public Long lengthOfValue(String key, String hashKey) {
        return hash.lengthOfValue(key, hashKey);
    }

    public Long size(String key) {
        return hash.size(key);
    }

    public void putAll(String key, Map<? extends String, ? extends String> m) {
        hash.putAll(key, m);
    }

    public void put(String key, String hashKey, String value) {
        hash.put(key, hashKey, value);
    }

    public Boolean putIfAbsent(String key, String hashKey, String value) {
        return hash.putIfAbsent(key, hashKey, value);
    }

    public List<String> values(String key) {
        return hash.values(key);
    }

    public Map<String, String> entries(String key) {
        return hash.entries(key);
    }
}
